#include "dht11_device.h"
#include <string.h>


static int DHT11DeviceInit(struct dHT11Dev *ptDHT11Dev)
{
   DHT11_GPIO_Init();
   DHT11_TIM_Init();
   return PDSUCCESS;
}


static int DHT11Device_GetValue(struct dHT11Dev *ptDHT11Dev)
{
    return DHT11_Read(&ptDHT11Dev->value.temperature, &ptDHT11Dev->value.humidity);
}



static dHT11Dev dHT11Devices = {
    .name = "DHT11",
    .value = {0}, 
    .Init = DHT11DeviceInit, 
    .GetValue = DHT11Device_GetValue
};


pDHT11Dev GetDHT11Device(char *name)
{
    if(strcmp(name, "DHT11") == 0)
    {
        return &dHT11Devices;
    }
    return NULL;
}

